import request from '@/utils/request'

export function preview(id) {
  return request({
    url: '/userWork/preview',
    method: 'post',
    id
  })
}

export function page(data) {
  return request({
    url: '/user/page',
    method: 'post',
    data
  })
}

export function add(teacher) {
  return request({
    url: '/user',
    method: 'post',
    data: teacher
  })
}

export function update(teacher) {
  return request({
    url: '/user/update',
    method: 'post',
    data: teacher
  })
}

export function selectById(id) {
  return request({
    url: '/user/' + id,
    method: 'get'
  })
}

export function renew(teacher) {
  return request({
    url: '/user/',
    method: 'put',
    data: teacher
  })
}
export function add_renew(teacher) {
  return request({
    url: '/user/',
    method: 'put',
    data: teacher
  })
}
export function information() {
  return request({
    url: '/user/my',
    method: 'get'
  })
}
export function password(data) {
  return request({
    url: '/user/password',
    method: 'post',
    data
  })
}
export function resetUserPwd(data) {
  return request({
    url: '/user/password',
    method: 'post',
    data
  })
}

export function userUpdateRoleRequest(data) {
  return request({
    url: '/user/updateRole',
    method: 'post',
    data
  })
}

export function updateUserProfile(data) {
  return request({
    url: '/user/update',
    method: 'post',
    data
  })
}
export function handleImport(data) {
  return request({
    url: '/user/excel-input',
    method: 'post',
    data
  })
}
export function handleExport(data) {
  return request({
    url: '/user/excel_output',
    method: 'post',
    data
  })
}

export function getRoleList() {
  return request({
    url: '/user/list',
    method: 'post'
  })
}
